package com.atom.wyz.new_opengl.ndk;

import android.content.Context;

import com.atom.wyz.new_opengl.AbstractGLSurfaceView;
import com.atom.wyz.new_opengl.R;
import com.atom.wyz.new_opengl.base.TextureRect;
import com.atom.wyz.new_opengl.util.MatrixState;
import com.atom.wyz.new_opengl.util.TextureUtil;

import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;

public class SimpleNDKGLSurfaceView extends AbstractGLSurfaceView {

    public SimpleNDKGLSurfaceView(Context context) {
        super(context);
    }

    @Override
    protected Renderer getRenderer() {
        return new SimpleRenderer();
    }

    class SimpleRenderer extends AbstractRenderer{
        JNIRenderer  renderer ;
        @Override
        protected void create(GL10 gl10, EGLConfig eglConfig) {
            renderer = new JNIRenderer() ;
            renderer.loadAssetManager(activity.getAssets());
            renderer.glesInit();
        }

        @Override
        protected void changed(GL10 gl10, int i, int i1, float ratio) {
            renderer.glesResize(i , i1);
        }

        @Override
        protected void draw(GL10 gl10) {
            renderer.glesRenderer();
        }
    }
}
